/**
 * 
 */
package cx3k.GUI;

import java.awt.GridBagConstraints;

import javax.swing.*;
import javax.swing.border.BevelBorder;
import javax.swing.border.SoftBevelBorder;

import cx3k.scheduler.objects.Course;

import java.awt.*;

/**
 * @author Chris
 *
 */
public class ClassInfo extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JLabel jlDESC;
	JLabel jlCRED;
	JLabel jlDIFF;
	JLabel jlClass;
	
	public ClassInfo() {
		this.setBackground(MainWindow.MAINCOLOR);
		JLabel jlTitle = new JLabel("ClassInfo:  ");
		JLabel jlDescription = new JLabel("Description: ");
		JLabel jlCredits = new JLabel("Credits:  ");
		JLabel jlDifficulty = new JLabel("Difficulty:  ");
		GridBagLayout gbl = new GridBagLayout();
		this.setLayout(gbl);
		GridBagConstraints gbc = new GridBagConstraints();
		this.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
		
		jlClass = new JLabel();
		Box hbox2 = Box.createHorizontalBox();
		hbox2.add(jlTitle);
		hbox2.add(jlClass);
		
		gbc.gridx = 0;
		gbc.gridy = 0; 
		gbc.gridwidth = 2; 
		gbc.gridheight = 1; 
		gbc.weightx = 100; 
		gbc.weighty = 10; 
		gbc.fill = GridBagConstraints.HORIZONTAL; 
		gbc.anchor = GridBagConstraints.LINE_START; 
		gbl.setConstraints(hbox2, gbc);
		this.add(hbox2);
		
		gbc.gridx = 0;
		gbc.gridy = 1; 
		gbc.gridwidth = 1; 
		gbc.gridheight = 1; 
		gbc.weightx = 50; 
		gbc.weighty = 10; 
		gbc.fill = GridBagConstraints.HORIZONTAL; 
		gbc.anchor = GridBagConstraints.LINE_START; 
		gbl.setConstraints(jlDescription, gbc);
		this.add(jlDescription);
		
		this.jlDESC = new JLabel("");
		gbc.gridx = 0;
		gbc.gridy = 2; 
		gbc.gridwidth = 2; 
		gbc.gridheight = 1; 
		gbc.weightx = 100; 
		gbc.weighty = 50; 
		gbc.fill = GridBagConstraints.BOTH; 
		gbc.anchor = GridBagConstraints.LINE_START; 
		gbl.setConstraints(jlDESC, gbc);
		this.add(jlDESC);
		
		this.jlCRED = new JLabel("0");
		Box hbox1 = Box.createHorizontalBox();
		hbox1.add(jlCredits);
		hbox1.add(jlCRED);
		
		gbc.gridx = 0;
		gbc.gridy = 3; 
		gbc.gridwidth = 1; 
		gbc.gridheight = 1; 
		gbc.weightx = 100; 
		gbc.weighty = 10; 
		gbc.fill = GridBagConstraints.HORIZONTAL; 
		gbc.anchor = GridBagConstraints.LINE_START; 
		gbl.setConstraints(hbox1, gbc);
		this.add(hbox1);
		
		
		this.jlDIFF = new JLabel("0");
		Box hbox = Box.createHorizontalBox();
		hbox.add(jlDifficulty);
		hbox.add(jlDIFF);
		hbox.add(Box.createHorizontalStrut(100));
		
		gbc.gridx = 0;
		gbc.gridy = 4; 
		gbc.gridwidth = 1; 
		gbc.gridheight = 1; 
		gbc.weightx = 100; 
		gbc.weighty = 10; 
		gbc.fill = GridBagConstraints.HORIZONTAL; 
		gbc.anchor = GridBagConstraints.LINE_START; 
		gbl.setConstraints(hbox, gbc);
		this.add(hbox);
		
	}
	
	public void update(Course c) {
		this.jlClass.setText(c.getName());
		this.jlCRED.setText(c.getCredits());
		this.jlDESC.setText(c.getDescription());
		this.jlDIFF.setText(c.getDifficulty() + "");
	}

	public String getClassID() { return jlClass.getText(); }
	public void setClass(String Class) { jlClass.setText(Class); }
	
	public String getDescription() { return jlDESC.getText(); }
	public void setDescription(String desc) { jlDESC.setText(desc); }
	
	public int getCredits() { return Integer.parseInt(jlCRED.getText()); }
	public void setCredits(int cred) { jlCRED.setText(new Integer(cred).toString()); }
	
	public int getDiff() { return Integer.parseInt(jlDIFF.getText()); }
	public void setDiff(int cred) { jlDIFF.setText(new Integer(cred).toString()); }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
